hang = 7
for i in range(1,2*((hang-1)//2+1),2) :
    print(("*"*i).center(hang))
for i in range(2*((hang-1)//2)-1,0,-2) :
        print(("*"*i).center(hang))

# 打印所有三位数中的水仙花数
for num in range(100, 1000):
    hundred = num // 100
    ten = (num // 10) % 10
    one = num % 10
    if num == hundred**3 + ten**3 + one**3:
        print(num)

#打印九九乘法表
for i in range(1,10):
    for j in range(1,i+1):
        print("%d*%d=%d"%(j,i,i*j),end="\t")
    print()

for i in range(1,10):
    for j in range(1,i+1):
        print("%d*%d=%d" % (j, i, i * j), end="\t")
    print("\n")


# 打印100以内的所有完美数
for num in range(1, 101):
    if num < 2:
        continue

    factors_sum = 1  # 初始化因数和为1（因为1总是因数）
    # 遍历从2到num//2的所有数
    for i in range(2, num // 2 + 1):
        if num % i == 0:
            factors_sum += i

    if factors_sum == num:
        print(num)


#打印质数
for i in range(2,100):
    for j in range(2,i):
        if i%j==0:
            break
    else:
        print(i)


#打印斐波那契数列
def f(n):
    if n <=0 :
        return 0
    if n == 1 :
        return  1
    else:
        return  f(n-1)+f(n-2)
for i in range(50):
    print(f(i))
